{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">详情</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"></table>
        <script type="text/html" id="barTool">

            <a class="layui-btn layui-btn-xs" data-open='{:url("editDesc")}?id={{ d.id }}' data-title="编辑内容"
               data-full="true">编辑</a>
            <a href='{:url("delDesc")}?ids={{ d.id }}'
               class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>

        </script>

    </div>

    <script type="text/html" id="picTpl">

        <img style="max-width:80px; max-height:30px;" src="{{d.img}}" data-image="{{d.name}}">

    </script>
</div>
{/block}
{block name="script"}
<script>
layui.use('yznTable', function() {
    var table = layui.yznTable;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        add_url: "{:url('addDesc')}?mcid={$mcid}",
        edit_url: "{:url('edit')}",
        delete_url: "{:url('del')}",
    };

    table.render({
        init: init,
        id: 'currentTable',
        elem: '#currentTable',
        url: '{:url("desc_list")}?mcid={$mcid}',
        toolbar: ['refresh', [{
            text: '创建',
            url: init.add_url,
            method: 'open',
            icon: 'iconfont icon-add',
            class: 'layui-btn layui-btn-normal layui-btn-sm',
            // extend: 'data-full="true"',
        }]],
        search:false,
        cols: [
            [
                // { type: 'checkbox', fixed: 'left' },
                { field: 'id', align: "center", width: '8%', title: 'ID' , search: false},
                { field: 'name', align: "center", width: '20%', title: '名称', search: false},
                { field: 'desc', align: "center", width: '20%', title: '简介', search: false},
               // { field: 'img', align: "center", width: '20%', title: '图标', search: false},
                {field: 'img', align: "center", width: '20%', title: '图标', templet: '#picTpl', search: false},
                // {
                //     field: 'status',align: "center", width: '20%', title: '显示状态',
                //     templet: function (d) {
                //         if (d.status == 0) {
                //             return '<span style="color: green">显示</span>';
                //         } else if (d.status == 1) {
                //             return '<span style="color: orange">隐藏</span>';
                //         }else{
                //             return '<span>未知</span>'
                //         }
                //     }, search: false
                // },
                { field: 'sort', align: "center", width: '20%', title: '排序', search: false},
                {fixed: 'right', align: 'center',width: '20%', title: '操作', toolbar: '#barTool'}
            ]
        ],
        page: {}
    });
    yznTable.bindevent();
});
</script>
{/block}